﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MSP.Business.ProductManagement;

namespace MSP.UI.Forms
{
    public partial class xfrmAddStock : DevExpress.XtraEditors.XtraForm
    {
        ProductManager productManager = new ProductManager();
        ProductActionManager productActionManager = new ProductActionManager();
        CurrencyManager manager;
        int LastFocusedRowHandle;

        public xfrmAddStock()
        {
            InitializeComponent();
        }

        private void xfrmAddStock_Load(object sender, EventArgs e)
        {
            LastFocusedRowHandle = -1;
            FormLoad();
        }

        void FormLoad()
        {
            manager = dataLayoutControl1.BindingContext[dataLayoutControl1.DataSource, dataLayoutControl1.DataMember] as CurrencyManager;

            ActionTypeLookUpEdit.Properties.DataSource = productActionManager.GetAllProductActionType();
            ActionTypeLookUpEdit.Properties.DisplayMember = "Name";
            ActionTypeLookUpEdit.Properties.ValueMember = "Value";
            ActionTypeLookUpEdit.Properties.Columns.Clear();
            ActionTypeLookUpEdit.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Hareket Türü"));

            ProductLookUpEdit.Properties.DataSource = productManager.GetAllProduct();
            ProductLookUpEdit.Properties.DisplayMember = "Name";
            ProductLookUpEdit.Properties.ValueMember = "Id";
            ProductLookUpEdit.Properties.Columns.Clear();
            ProductLookUpEdit.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Ürün Adı"));
            ProductLookUpEdit.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Barcode", "Barkod"));

            //InitValidationRules();
        }

        private void grdSearch_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {

        }

        private void btnAdd_Click(object sender, EventArgs e)
        {

        }
    }
}